package com.example.experiment3.observerPattern;

public class TEST {
    public void test(){
        // 创建具体主题
        WeChatOfficialAccount weChatOfficialAccount  = new WeChatOfficialAccount();
        // 创建微信用户
        WeChatUser user1 = new WeChatUser("孙悟空");
        WeChatUser user2 = new WeChatUser("猪悟能");
        WeChatUser user3 = new WeChatUser("沙悟净");
        //订阅公众号
        weChatOfficialAccount.attach(user1);
        weChatOfficialAccount.attach(user2);
        weChatOfficialAccount.attach(user3);
        //公众号更新发出消息给订阅的微信用户
        weChatOfficialAccount.notify("来了！新闻早班车");
    }
    }

